﻿using Infrastructure.Utility.Core.CommonUtility;
using System.Text.RegularExpressions;

namespace Infrastructure.Utility.Core
{

    /// <summary>
    /// 生成pdf所需客户数据
    /// </summary>
    public sealed class CustomerInfo
    {
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }


        /// <summary>
        /// 电话
        /// </summary>
        private string mobile;
        /// <summary>
        /// 手机号
        /// </summary>

        public string Mobile { get => Regex.Replace(mobile ?? "", "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); set => mobile = (value ?? ""); }

        /// <summary>
        /// 所属城市
        /// </summary>
        public string City { get; set; }


        /// <summary>
        /// 身份证号
        /// </summary>
        private string idCard { get; set; }
        //public string IdCard { get => Regex.Replace(idCard ?? "", "(\\d{4})\\d{12}(\\d{2})", "$1************$2"); set => idCard = (value ?? ""); }
        public string IdCard { get => Regex.Replace(idCard ?? "", "(\\d{3})\\d*([0-9a-zA-Z]{3})", "$1************$2"); set => idCard = (value ?? ""); }

        public string Gender { get => idCard.GetGenderNameFromIdCard(); }
        /// <summary>
        /// 紧急联系人方式
        /// </summary>

        private string telePhone { get; set; }
        public string TelePhone { get => Regex.Replace(telePhone ?? "", "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); set => telePhone = (value ?? ""); }

        /// <summary>
        /// 工作单位
        /// </summary>
        public string WorkUnit { get; set; }

    }
}